package com.kgcx.opc.common.utils.String;

import org.apache.commons.lang3.StringUtils;

/**
 * @author 何凯
 * @version 0.1
 * @description
 * @time 2017/12/21 13:45
 * @since 0.1
 */
public class StringUtil {

    public static String subStr(String str){
      if(StringUtils.isNotEmpty(str)){
       String [] temp= str.split("\\.");
       StringBuilder sb = new StringBuilder();
       if(temp[1].length()>6){

           sb.append(temp[0]).append(temp[1].substring(0,6));
           return sb.toString();
       }else {
           sb.append(temp[0]).append(temp[1].substring(0,6));
           return sb.toString();
       }
       }else {
          return "0";
      }
    }

    public static void main(String[] args) {
        System.out.println(StringUtil.subStr("12.234345567"));
    }
}
